[+:   -*- Mode: nroff -*-

AutoGen5 template man=%s.1a
:+][+:

(define man-sect "8") :+][+:

(setenv "SHELL" "/bin/sh")
:+]
.TH [+: % prog-name (string-upcase! "%s") :+] [+: (. man-sect) :+] [+:
  `date +%Y-%m-%d` :+] "[+:
  IF (or (exist? "package") (exist? "version"))
    :+]([+: package :+] [+: version :+])[+:
  ENDIF :+]" "Programmer's Manual"
[+:
;; The following "dne" argument is a string of 5 characters:
;; '.' '\\' '"' and two spaces.  It _is_ hard to read.
;;
(dne ".\\\"  ") :+][+:  # balance quotes for emacs: "

:+]
.\"
.SH NAME
.B [+:(define prog-name (string-downcase! (get "prog-name")))
      (define PROG_NAME (string-tr! (get "prog-name") "a-z^-" "A-Z__"))
      (define prog_name (string-tr! (get "prog-name") "A-Z^-" "a-z__")) 
      prog-name :+] \- 
[+:prog-title :+][+:
;;now comes the synopsis part :+]
.SH SYNOPSIS
.B [+:
  (define use-flags (if (exist? "flag.value") #t #f))
  prog-name

:+][+:

  INCLUDE "agman-lib.tpl"

:+][+:

  IF (define named-mode (not (or use-flags (exist? "long_opts") )))
     use-flags  :+][+:

    IF (exist? "long_opts") :+][+:

      # * * * * *
      #
      :+]
.\" Mixture of short (flag) options and long options
.RB [ -\fIflag\fP " [\fIvalue\fP]]... [" --\fIopt-name\fP [+:#
:+]" [[=| ]\fIvalue\fP]]..."[+:

    ELSE no long options:+][+:

      # * * * * *
      #
      :+]
.\" Short (flag) options only
.RB [ -\fIflag\fP " [\fIvalue\fP]]..."[+:
    ENDIF :+][+:

  ELIF (exist? "long_opts") :+][+:

      # * * * * *
      #
      :+]
.\" Long options only
.RB [ --\fIopt-name\fP [ = "| ] \fIvalue\fP]]..."[+:

  ELIF  (not (exist? "argument")) :+][+:

      # * * * * *
      #
      :+]
.\" All arguments are named options.
.RI [ opt-name "[\fB=\fP" value ]]...
.PP
All arguments are named options.[+:

  ELSE :+][+:
    (error "Named option programs cannot have arguments") :+][+:
  ENDIF :+][+:

  IF (exist? "argument") :+]
.br
.in +8
[+: argument :+][+:

    IF (exist? "reorder-args") :+]
.br
Operands and options may be intermixed.  They will be reordered.
[+: ENDIF :+][+:

  ELIF (or (exist? "long_opts") use-flags) :+]
.PP
All arguments must be options.[+:
  ENDIF :+][+:

      # * * * * * * * * * * * * * * * * * * * * * * * * *
      #
      #  Describe the command.  Use 'prog_man_desrip' if it exists,
      #  otherwise use the 'detail' help option.  If not that,
      #  then the thing is undocumented.
      #
      :+][+:
IF (exist? "explain") :+]
.PP
[+:explain:+][+:
ENDIF :+]
